/*
* $Id: PictureButton.h 2 2009-12-23 13:58:02Z volok-aleksej@yandex.ru $
*
* Copyright 2008 by Volokitin Alexey
* All rights reserved
*
*/
#ifndef _PICTURE_BUTTON_H_
#define _PICTURE_BUTTON_H_

#include "Wnd.h"

#define LEFT_POS	-1
#define DOWN_POS	0
#define RIGHT_POS	1
#define UP_POS		2

class CPictureButton : public CButton, public CWndImpl
{
	CBitmap* m_pBitmap;
	CBitmap* m_pBitmapSelected;
	CRect m_rectText;
	CRect m_rectImage;
	std::tstring m_strVisualName;
private:
	std::tstring m_strNameButton;
	int m_nIdResource;
	CFont* m_pFont;
	int m_nPosText;
private:
	void InitFirstDraw(CRect rectWin, HDC dc);
	void SetTextDraw(HDC dc);
	CBitmap* SetBkBitmap(bool bSel);
	COLORREF GetSelColor(COLORREF buf);
protected:
	DECLARE_MESSAGE_MAP();
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg BOOL OnSetCursor(CWnd*, UINT, UINT);
	virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
public:
	CPictureButton(int IdResource, const std::tstring& strNameButton, int posText = 1);
	virtual ~CPictureButton();
public:
	BOOL Create(const RECT& rect, CWnd* pParentWnd,	UINT nID);
};

#endif /*_PICTURE_BUTTON_H_*/
